Ext.namespace('VAS');

VAS.CategoryContentPanel = function(config) {
	this.config = config;
    VAS.CategoryContentPanel.superclass.constructor.call(this,config);
}
Ext.extend(VAS.CategoryContentPanel,Ext.FormPanel, {
	initComponent : function() {
		var config = {
			bodyStyle:'padding:5px 15px 0 ',
			width         : '100%',
            frame         : true,
            fileUpload    : true,
		    minButtonWidth: 50,
		    buttonAlign   : 'right',
		    height        : 350,
			labelAlign    : 'left',
            layout        : 'column',
            autoScroll    : true,
            items         : [{
				layout      : 'column',
				columnWidth : 1,
				border      : false,
				items       : [{
					columnWidth : .33,
					layout      : 'form',
					border      : false,
					items       : [ {
							labelStyle      : "width:110px;text-align:left",
							xtype           : 'textfield',
							fieldLabel      : '所属业务',
							disabled        : true,
							id              : 'businessName',
							name            : 'businessName'
						}, {
							labelStyle      : "width:110px;text-align:left",
							xtype           : 'textfield',
							fieldLabel      : '文章列表每页条数',
							name            : 'pagesize',
			                regex			: /^[0-9]{1,3}$/,
			                regexText		: '必须为不大于3位的正整数'
						}, 
						{
				            xtype: 'radiogroup',
				            id     : "displayState",
				            fieldLabel : '开启状态',
				            labelStyle  : "width:110px;text-align:left",
				            width   : 120,
				            height	: 22,
				            items: [
					                {boxLabel: '是', name: 'displayState', inputValue:"1",checked: true},
					                {boxLabel: '否', name: 'displayState', inputValue:"0"}
            				]
						},	
						{
							labelStyle            : "width:110px;text-align:left",
							xtype                 : 'textfield',
							fieldLabel            : '产品代码',
							disabled              : true,
							vtype                 : 'MaxLen100',
							blankText             : "必填项",
							id                    : 'productCode',
							name                  : 'productCode'
						}, 
			 			{
							labelStyle      : "width:110px;text-align:left",
							xtype           : 'textfield',
							fieldLabel      : '标清URl地址',
							id              : 'sdUrl',
							name            : 'sdUrl',
							vtype           : 'webDomai'
						}]
				},
				{
					columnWidth : .33,
					layout : 'form',
					border : false,
					items : [ {
							labelStyle      : "width:110px;text-align:left",
							xtype           : 'textfield',
							fieldLabel      : '所属栏目',
							disabled        : true,
							id				: 'parentChannelName',
							name            : 'parentChannelName'
						}, {
							labelStyle      : "width:110px;text-align:left;",
							xtype           : 'textfield',
							fieldLabel      : '排序值',
							name            : 'orderNumber',
			                maxLength       : 5,
			                maxLengthText   : "最大长度为5位"					
						},
						{
				            xtype: 'radiogroup',
				            id     : "isCommend",
				            fieldLabel : '是否推荐',
				            width   : 120,
				            height	: 22,
				            labelStyle  : "width:110px;text-align:left",
			              	items: [
				                {boxLabel: '是', name: 'isCommend', inputValue:"1"},
				                {boxLabel: '否', name: 'isCommend', inputValue:"0",checked: true}
					        	]
						},	
							new Ext.form.ComboBox({
			 				store: new Ext.data.SimpleStore({
								fields: ["returnValue", "displayText"],
						        data: [["-1","全部"],["1","部分"],["0","不发"]]
						    }),
			                fieldLabel : '元数据发布策略',
			                labelStyle  : "width:110px;text-align:left",
							name:'contentPublish',
							hiddenName:'contentPublish',
							id:'contentPublish1',
							mode: 'local',
							width:120,
							editable: false,
							triggerAction: 'all',
							valueField: 'returnValue',
							displayField: 'displayText'
						})
						, 
				 		{
							labelStyle      : "width:110px;text-align:left",
							xtype           : 'textfield',
							fieldLabel      : '高清URl地址',
							id              : 'hdUrl',
							name            : 'hdUrl',
							vtype           : 'webDomai'
						}
						]
				},
				{
					columnWidth : .33,
					layout : 'form',
					border : false,
					items : [{
							labelStyle      : "width:110px;text-align:left; color:red",
							xtype           : 'textfield',
							fieldLabel      : '栏目名称',
							name            : 'channnelName',
							blankText       : "必填项",
							vtype           : 'CheckBlankOnly',
							allowBlank      : false,
							maxLength       : 20,
			                maxLengthText   : "最大长度为20位",
			                regex			: /^[^%&*\/',;=?$\x22]+$/,
			                regexText		: '栏目名称中不能含有特殊字符'
						},
						
						{
							labelStyle      : "width:110px;text-align:left",
							xtype           : 'textfield',
							vtype           : 'MaxLen100',
							fieldLabel      : '视频栏目代码',
							name            : 'vodCode',
							id              : 'vodCode'
						},
						{
				            xtype: 'radiogroup',
				            id     : "authorizeState",
				            fieldLabel : '是否鉴权',
				            labelStyle  : "width:110px;text-align:left",
				            width   : 120,
				            height	: 22,
			              	items: [
					                {boxLabel: '是', name: 'authorizeState', inputValue:"1"},
					                {boxLabel: '否', name: 'authorizeState', inputValue:"0",checked: true}
        					]
						},{
							labelStyle            : "width:110px;text-align:left",
							xtype                 : 'textfield',
							fieldLabel            : 'OCG下发条数',
							blankText             : "必填项",
			                regex				  : /^[0-9]{1,3}$/,
			                regexText			  : '必须为不大于3位的正整数',
							id                    : 'ocgPubSize',
							name                  : 'ocgPubSize'
						}
						, {
							labelStyle      : "width:110px;text-align:left",
							xtype           : 'textfield',
							fieldLabel      : 'portal下发条数',
							id              : 'portalPubSize',
							name            : 'portalPubSize',
							regex			: /^[0-9]{1,11}$/,
			                regexText		: '必须为不大于11位的正整数'
						}
						
					]
				}
				]
			},
			{
			
				layout      : 'column',
				columnWidth : 1,
				border      : false,
				items       : [{
					columnWidth : .5,
					layout      : 'form',
					border      : false,
					items : [
						new Ext.form.ComboBox({
							store   : new Ext.data.Store({
									proxy     : new Ext.data.HttpProxy({url:'admin/channel/ChannelAction!getChannelHDTemplate.action'+this.config.exParams}),
									reader    : new Ext.data.JsonReader({
										root  : 'data'
									}, [
										{name : 'id'},
										{name : 'name'}
									])							
							}),
				            fieldLabel    : '高清栏目页模板',
				            labelStyle    : "width:110px;text-align:left",
							name          : 'channelHDTemplate',
							id            : 'channelHDTemplate',
							mode          : 'remote',
							width         : 256,
							editable      : false,
							triggerAction : 'all',
							valueField    : 'id',
							displayField  : 'name'
						})	
					]
				},{
					columnWidth : .5,
					layout : 'form',
					border : false,
					items : [
						new Ext.form.ComboBox({
							store   : new Ext.data.Store({
									proxy     : new Ext.data.HttpProxy({url:'admin/channel/ChannelAction!getChannelSDTemplate.action'+this.config.exParams}),
									reader    : new Ext.data.JsonReader({
										root  : 'data'
									}, [
										{name : 'id'},
										{name : 'name'}
									])							
							}),
				            fieldLabel    : '标清栏目页模板',
				            labelStyle    : "width:110px;text-align:left",
							name          : 'channelSDTemplate',
							id            : 'channelSDTemplate',
							mode          : 'remote',
							width         : 256,
							editable      : false,
							triggerAction : 'all',
							valueField    : 'id',
							displayField  : 'name'
						})	
					]
				}
				]
			
			},
			{
			
				layout      : 'column',
				columnWidth : 1,
				border      : false,
				items       : [{
					columnWidth : .5,
					layout      : 'form',
					border      : false,
					items : [
						new Ext.form.ComboBox({
							store   : new Ext.data.Store({
									proxy     : new Ext.data.HttpProxy({url:'admin/channel/ChannelAction!getContentHDTemplate.action'+this.config.exParams}),
									reader    : new Ext.data.JsonReader({
										root  : 'data'
									}, [
										{name : 'id'},
										{name : 'name'}
									])							
							}),
				            fieldLabel    : '高清内容页模板',
				            labelStyle    : "width:110px;text-align:left",
							name          : 'contentHDTemplate',
							id            : 'contentHDTemplate',
							mode          : 'remote',
							width         : 256,
							editable      : false,
							triggerAction : 'all',
							valueField    : 'id',
							displayField  : 'name'
						})	
					]
				},{
					columnWidth : .5,
					layout : 'form',
					border : false,
					items : [
						new Ext.form.ComboBox({
							store   : new Ext.data.Store({
									proxy     : new Ext.data.HttpProxy({url:'admin/channel/ChannelAction!getContentSDTemplate.action'+this.config.exParams}),
									reader    : new Ext.data.JsonReader({
										root  : 'data'
									}, [
										{name : 'id'},
										{name : 'name'}
									])							
							}),
				            fieldLabel    : '标清内容页模板',
				            labelStyle    : "width:110px;text-align:left",
							name          : 'contentSDTemplate',
							id            : 'contentSDTemplate',
							mode          : 'remote',
							width         : 256,
							editable      : false,
							triggerAction : 'all',
							valueField    : 'id',
							displayField  : 'name'
						})	
					]
				}
				]
			
			}
			,{
					layout      : "table",
					columnWidth : 1,
					items: [
						{
							xtype           : "panel",
							layout          : "form",
							width           : 113,
							items           : {xtype: "label", fieldLabel: "栏目小图",	labelStyle:"text-align:left"}
						},{
			            	xtype           : 'fileuploadfield',
			            	buttonText      : '浏览...',
			            	name            : 'smallPhoto',
			            	id              : 'smallPhoto',
			            	width           : 260
						},{
							id              : 'smallPhotoDesc',
							xtype           : "label",
							hideLabel       : true
						}
						,{
							xtype           : 'hidden',
							id              : 'smallphotoflag',
							name            : 'smallphotoflag'
						}
					]
			},{
					layout      : "table",
					columnWidth : 1,
					items: [
						{
							xtype           : "panel",
							layout          : "form",
							width           : 113,
							items           : {xtype: "label", fieldLabel: "栏目大图",	labelStyle:"text-align:left"}
						},{
		            		xtype           : 'fileuploadfield',
		            		buttonText      : '浏览...',
			            	name            : 'bigPhoto',
			            	id              : 'bigPhoto',
		            		width           : 260
						},{
							id              : 'bigPhotoDesc',
							xtype           : "label",
							hideLabel       : true
						}
						,{
							xtype           : 'hidden',
							id              : 'bigphotoflag',
							name            : 'bigphotoflag'
						}						
					]
			},{
					layout      : "table",
					columnWidth : 1,
					items: [
						{
							xtype           : "panel",
							layout          : "form",
							width           : 113,
							items           : {xtype: "label", fieldLabel: "音频文件",	labelStyle:"text-align:left"}
						},{
		            		xtype           : 'fileuploadfield',
		            		buttonText      : '浏览...',
			            	name            : 'audio',
			            	id              : 'audio',
		            		width           : 260
		            	},{
							id              : 'audioDesc',
							xtype           : "label",
							hideLabel       : true
						}
						,{
							xtype           : 'hidden',
							id              : 'audioflag',
							name            : 'audioflag'
						}							
					]
			},{
					layout         : "table",
					columnWidth    : 1,
					bodyStyle      : "margin:5px 0px 0px 0px",
					items: [
						{
							xtype          : "panel",
							layout         : "form",
							width          : 113,
							items          : {xtype: "label", fieldLabel: "栏目描述",labelStyle:"text-align:left"}
						}, 	
						new Ext.TabPanel({
						 	id       : 'contentTab',
					        activeTab: 0,
					        width:720,
					        height:230,
					        plain:true,
					        items:[{
					        		id  : "panel_htmleditor",
					                title: 'HTML 编辑',
									items : [{
										xtype : 'htmleditor',
										width : 720,
										height : 203,
										id : 'description1',
										name : 'description1',
										defaultValue : '',
										plugins : [
											new Ext.ux.form.HtmlEditor.MidasCommand()
											,new Ext.ux.form.HtmlEditor.Divider()
	//													,new Ext.ux.form.HtmlEditor.Word()
											,new Ext.ux.form.HtmlEditor.Table()
											,new Ext.ux.form.HtmlEditor.HR()
											,new Ext.ux.form.HtmlEditor.IndentOutdent()
											,new Ext.ux.form.HtmlEditor.SubSuperScript()
											,new Ext.ux.form.HtmlEditor.RemoveFormat()
										]
									}]
					            }
					            ,{
					            	id  : "panel_textarea",
					                title: '纯文本编辑',
					                items :[{
					                    xtype          : 'textarea',
					                    width          : 720,
					                    height         : 203,
				                   		id             : 'description2',
				                   		name           : 'description2',
				                   		vtype          : 'MaxLen4000'
									}]
					            }
					        ]
					    })
					]
			},
			{
				xtype  : 'hidden',
				name   : 'channelId',				
				id     : 'channelId'				
			},{
				xtype  : 'hidden',
				name   : 'businessId',				
				id     : 'businessId'				
			},{
				xtype  : 'hidden',
				name   : 'parentChannelId',				
				id     : 'parentChannelId'				
			},{
				xtype  : 'hidden',
				name   : 'description',				
				id     : 'description'				
			}]
		}
		Ext.apply(this, config);
		Ext.apply(this.initialConfig, config);
		VAS.CategoryContentPanel.superclass.initComponent.apply(this, arguments);		
	},
	
	checkForm : function() {
		/* 图片类型校验 */
		var imgType = "jpg|png|bmp|gif|jpeg";
		var smallPhoto = Ext.getCmp("smallPhoto");
		var bigPhoto = Ext.getCmp("bigPhoto");
		var audio = Ext.getCmp("audio");
		var ocgPubSize = Ext.getCmp("ocgPubSize");

		

		// 栏目小图
		if (smallPhoto.getValue() != "") {
			var filetype = smallPhoto.getValue().substring(
					smallPhoto.getValue().lastIndexOf('.') + 1,
					smallPhoto.getValue().length);
			if (imgType.indexOf(filetype.toLowerCase()) == -1) {
				Ext.Msg.alert("提示", "栏目小图只能上传图片类型文件！",function(bt){
					smallPhoto.setValue("");
					smallPhoto.reset();
				});
				return false;
			}
		}

		// 栏目大图
		if (bigPhoto.getValue() != "") {
			var filetype = bigPhoto.getValue().substring(
					bigPhoto.getValue().lastIndexOf('.') + 1,
					bigPhoto.getValue().length);
			if (imgType.indexOf(filetype.toLowerCase()) == -1) {
				Ext.Msg.alert("提示", "栏目大图只能上传图片类型文件！",function(bt){
					bigPhoto.setValue("");
					bigPhoto.reset();
				});
				return false;
			}
		}

		// 音频文件
		if (audio.getValue() != "") {
			var filetype = audio.getValue().substring(
					audio.getValue().lastIndexOf('.') + 1,
					audio.getValue().length);
			if ("mp3".indexOf(filetype.toLowerCase()) == -1) {
				Ext.Msg.alert("提示", "音频文件只能上传MP3文件！",function(bt){
					audio.setValue("");
					audio.reset();
				});
				return false;
			}
		}

		return true;
	}
	
	
});


VAS.CategoryContentWindow = function($config) {
 	var _this = this;
	_this.$config = $config;
	
	var form  = new VAS.CategoryContentPanel({
		url       : $config.formUrl,
		exParams  : $config.exParams
	});
	
	var comboxselectFn = function(combo,record,index){
		if(contentPublish.getValue() == "1") {
			ocgPubSize.setDisabled(false);
			ocgPubSize.allowBlank = false;
			ocgPubSize.validate();	
		} else {
			ocgPubSize.setDisabled(true);
			ocgPubSize.allowBlank = true;
			ocgPubSize.validate();	
		}
	}    
	
	// 元数据发布策略
	var contentPublish = Ext.getCmp("contentPublish1");
	// OCG下发条数
	var ocgPubSize = Ext.getCmp("ocgPubSize");	
	var productCode = Ext.getCmp("productCode");
	var  authorizeState = Ext.getCmp("authorizeState");
	var vodCode = Ext.getCmp("vodCode");
	var  sdUrl = Ext.getCmp("sdUrl");
	var  hdUrl = Ext.getCmp("hdUrl");	
	
	authorizeState.on("change",function(radio,newValue,oldValue){
		if (newValue.getGroupValue() == 1) {
			productCode.setDisabled(false);
			productCode.allowBlank = false;
			productCode.validate();	
			
			/*contentPublish.store.loadData([["0","不发"]],false);
			contentPublish.setValue("0");
			contentPublish.fireEvent('select',comboxselectFn);*/
			
		} else {
			productCode.setDisabled(true);
			productCode.allowBlank = true;
			productCode.validate();	
			
			/*if (vodCode.getValue() == ""  && sdUrl.getValue() == "" && hdUrl.getValue() == "") {
				contentPublish.store.loadData([["-1","全部"],["1","部分"],["0","不发"]],false);
				contentPublish.setValue("1");
				contentPublish.fireEvent('select',comboxselectFn);				
			}*/
			
		}		
	})
	
	contentPublish.on("select",comboxselectFn);
	vodCode.on("blur",function(field){
		if(this.getValue()!="") {
			contentPublish.store.loadData([["0","不发"]],false);
			contentPublish.setValue("0");
			contentPublish.fireEvent('select',comboxselectFn);
		} else {
			if (authorizeState.getValue().inputValue == "0" && hdUrl.getValue() == "" && sdUrl.getValue() == "") {
				contentPublish.store.loadData([["-1","全部"],["1","部分"],["0","不发"]],false);
				contentPublish.setValue("1");
				contentPublish.fireEvent('select',comboxselectFn);		
			}
		}
		
	});


	sdUrl.on("blur",function(field){
		if(this.getValue()!="") {
			contentPublish.store.loadData([["0","不发"]],false);
			contentPublish.setValue("0");
			contentPublish.fireEvent('select',comboxselectFn);
		} else {
			if (vodCode.getValue() == "" && authorizeState.getValue().inputValue == "0" && hdUrl.getValue() == "") {
				contentPublish.store.loadData([["-1","全部"],["1","部分"],["0","不发"]],false);
				contentPublish.setValue("1");
				contentPublish.fireEvent('select',comboxselectFn);		
			}
		}
		
	});
	
	hdUrl.on("blur",function(field){
		if(this.getValue() != "") {
			contentPublish.store.loadData([["0","不发"]],false);
			contentPublish.setValue("0");
			contentPublish.fireEvent('select',comboxselectFn);
		} else {
			if (vodCode.getValue() == "" && authorizeState.getValue().inputValue == "0" && sdUrl.getValue() == "") {
				contentPublish.store.loadData([["-1","全部"],["1","部分"],["0","不发"]],false);
				contentPublish.setValue("1");
				contentPublish.fireEvent('select',comboxselectFn);		
			}
		}
		
	});
	
	var _store  = _this.$config.grid.store;
	var _form = form.getForm();
	var thisConfig = {
		autoScroll    : true,
		frame         : true,
		items         : form
	}
		
	if($config.actionType == 'addChannel'){
		Ext.apply(thisConfig,{
			buttons : [{
	            	xtype   : 'button',
	            	text    : '保存',
	            	handler : function() {
			        	
	            		if (Ext.getCmp("contentTab").getActiveTab().id == "panel_htmleditor") {
							Ext.getCmp("description").setValue(Ext.getCmp("description1").getValue());
	            		} else {
	            			var descriptionV = Ext.getCmp("description2").getValue().replace(/\r\n/gi, '\\r\\n').replace(/\n/gi, '\\n')  
							Ext.getCmp("description").setValue(descriptionV);            			
	            		}
	            		
						if(_form.isValid() && form.checkForm()){
								_form.submit({
						              url              : _form.url,
									  waitTitle        : '正在提交',
						              waitMsg          : '正在向服务器发送请求',
						              clientValidation : true,
									  success : function(form,action){
									  		_form.reset();
											_this.loadForm();
											_store.reload();
									  },
									  failure :function(form,action){
											if(action.failureType == Ext.form.Action.CLIENT_INVALID){
												Ext.Msg.alert('失败','输入的信息不符合规格，请按照提示重新输入！');
											}else{
												Ext.Msg.alert("失败",action.result.msg,function(){
													if(action.result.callback!='undefined'){
										          		eval(action.result.callback);
									          		}
												});
											}
									 }		
						        });
						  }
	            	}
			    }
				,{
	            	xtype   : 'button',
	            	text    : '保存并关闭',
	            	handler : function() {
	            		if (Ext.getCmp("contentTab").getActiveTab().id == "panel_htmleditor") {
							Ext.getCmp("description").setValue(Ext.getCmp("description1").getValue());            			
	            		} else {
	            			var description = Ext.getCmp("description2").getValue().replace(/\r\n/gi, '\\r\\n').replace(/\n/gi, '\\n')  
							Ext.getCmp("description").setValue(description);            			
	            		}  
						if(_form.isValid() && form.checkForm()){
								_form.submit({
						              url              : _form.url,
									  waitTitle        : '正在提交',
						              waitMsg          : '正在向服务器发送请求',
						              clientValidation : true,
									  success : function(form,action){
											_this.close();
											_this.$config.grid.store.reload();
											var menu = session.get("channelMenu");
											if (typeof menu != undefined) {
	            								menu.getRootNode().reload();
											}
									  },
									  failure :function(form,action){
											if(action.failureType == Ext.form.Action.CLIENT_INVALID){
												Ext.Msg.alert('失败','输入的信息不符合规格，请按照提示重新输入！');
											}else{
												Ext.Msg.alert("失败",action.result.msg,function(){
													if(action.result.callback!='undefined'){
										          		eval(action.result.callback);
									          		}
												});
											}
									 }		
						        });
						  }
	            	}
			    },{
	            	xtype:'button',
	            	text:'关闭',
	            	handler : function() {
						var menu = session.get("channelMenu");
							if (typeof menu != undefined) {
								menu.getRootNode().reload();
						}
	            		_this.close();	
	            	}            	
			    }]
			})
		}else{
					Ext.apply(thisConfig,{
			buttons : [{
	            	xtype   : 'button',
	            	text    : '保存并关闭',
	            	handler : function() {
	            		if (Ext.getCmp("contentTab").getActiveTab().id == "panel_htmleditor") {
							Ext.getCmp("description").setValue(Ext.getCmp("description1").getValue());            			
	            		} else {
	            			var description = Ext.getCmp("description2").getValue().replace(/\r\n/gi, '\\r\\n').replace(/\n/gi, '\\n')  
							Ext.getCmp("description").setValue(description);            			
	            		}  
						if(_form.isValid() && form.checkForm()){
								_form.submit({
						              url              : _form.url,
									  waitTitle        : '正在提交',
						              waitMsg          : '正在向服务器发送请求',
						              clientValidation : true,
									  success : function(form,action){
											_this.close();
											_this.$config.grid.store.reload();
											var menu = session.get("channelMenu");
											if (typeof menu != undefined) {
	            								menu.getRootNode().reload();
											}
									  },
									  failure :function(form,action){
											if(action.failureType == Ext.form.Action.CLIENT_INVALID){
												Ext.Msg.alert('失败','输入的信息不符合规格，请按照提示重新输入！');
											}else{
												Ext.Msg.alert("失败",action.result.msg,function(){
													if(action.result.callback!='undefined'){
										          		eval(action.result.callback);
									          		}
												});
											}
									 }		
						        });
						  }
	            	}
			    },{
	            	xtype:'button',
	            	text:'关闭',
	            	handler : function() {
	            		_this.close();	
	            	}            	
			    }]
			})
		}
	
	var _config = $config || {};
	Ext.apply(_this, Ext.apply(thisConfig, _config));
	VAS.CategoryContentWindow.superclass.constructor.call(_this);

};
Ext.extend(VAS.CategoryContentWindow,VAS.BasicWindow,{
	manager:wgroup,
	loadForm:function(){
		this.items.itemAt(0).load({
			    waitTitle   : '正在加载中...',
				waitMsg     : '正在向服务器发送请求', 
	 			url         : this.$config.loadUrl,
	 			success     : function(form,action) {	
	 				
	 				var contentPublish = Ext.getCmp("contentPublish1");
	 				var productCode = Ext.getCmp("productCode");
	 				var ocgPubSize = Ext.getCmp("ocgPubSize");
	 				var vodCode = Ext.getCmp("vodCode");
	 				var sdUrl = Ext.getCmp("sdUrl");
	 				var hdUrl = Ext.getCmp("hdUrl");
					var comboxselectFn = function(combo,record,index){
						if(contentPublish.getValue() == "1") {
							ocgPubSize.setDisabled(false);
							ocgPubSize.allowBlank = false;
							ocgPubSize.validate();	
						} else {
							ocgPubSize.setDisabled(true);
							ocgPubSize.allowBlank = true;
							ocgPubSize.validate();	
						}
					} 	 			
					
	 				if (action.result.data["authorizeState"] == 1) {
	 					productCode.setDisabled(false);
	 					productCode.allowBlank = false;
						productCode.validate();	
	 				} else {
	 					productCode.setDisabled(true);
	 					productCode.allowBlank = true;
						productCode.validate();	
	 				}
	 				
	 				if (action.result.data["contentPublish"] != 1) {
	 					ocgPubSize.setDisabled(true);
	 					ocgPubSize.allowBlank = true;
						ocgPubSize.validate();	
	 				} else {
	 					ocgPubSize.setDisabled(false);
	 					ocgPubSize.allowBlank = false;
						ocgPubSize.validate();	
	 				}
	 				
	 				if (action.result.data["vodCode"] != "") {
	 					contentPublish.store.loadData([["0","不发"]],false);
						contentPublish.setValue("0");
						contentPublish.fireEvent('select',comboxselectFn);
	 				}
	 				
	 				if (action.result.data["sdUrl"] != "" || action.result.data["hdUrl"] != "") {
	 					contentPublish.store.loadData([["0","不发"]],false);
						contentPublish.setValue("0");
						contentPublish.fireEvent('select',comboxselectFn);
	 				}
	 				
	 				
	 				
	 				
	 				var smallPhotoName = action.result.data["smallPhotoFileName"];
	 				var smallPhotoDesc = Ext.getCmp("smallPhotoDesc");
	 				if (smallPhotoName != "" && smallPhotoName != "null"  && smallPhotoName != undefined) {
	 					smallPhotoDesc.setValue("<font size='2' color='red'><a href=javascript:exportFile('admin/channel/ChannelAction!exportFile.action?id='+Ext.getCmp('channelId').getValue()+'&type=smallPhoto')>"+smallPhotoName+"</a>&nbsp;&nbsp;&nbsp;&nbsp;" +
	 							"<a href=# onclick= deleteFile('smallPhoto','smallPhotoDesc','smallphotoflag');>删除</a></font>");
	 				}	 				
	 				
	 				var bigPhotoName = action.result.data["bigPhotoFileName"];
	 				var bigPhotoDesc = Ext.getCmp("bigPhotoDesc");
	 				if (bigPhotoName != "" && bigPhotoName != "null"  && bigPhotoName != undefined) {
	 					bigPhotoDesc.setValue("<font size='2' color='red'><a href=javascript:exportFile('admin/channel/ChannelAction!exportFile.action?id='+Ext.getCmp('channelId').getValue()+'&type=bigPhoto')>"+bigPhotoName+"</a>&nbsp;&nbsp;&nbsp;&nbsp;" +
	 							"<a href=# onclick= deleteFile('bigPhoto','bigPhotoDesc','bigphotoflag');>删除</a></font>");	 					
	 				}	 				
	 				var audioName = action.result.data["audioFileName"];
	 				var audioDesc = Ext.getCmp("audioDesc");
	 				if (audioName != "" && audioName != "null"  && audioName != undefined) {
	 					audioDesc.setValue("<font size='2' color='red'><a href=javascript:exportFile('admin/channel/ChannelAction!exportFile.action?id='+Ext.getCmp('channelId').getValue()+'&type=audio')>"+audioName+"</a>&nbsp;&nbsp;&nbsp;&nbsp;" +
	 							"<a href=# onclick= deleteFile('audio','audioDesc','audioflag');>删除</a></font>");	 					
	 				}	 
	 				
	 				var description = action.result.data["description"];
	 				var contentTab  = Ext.getCmp("contentTab");
	 				var pattern = /<\/?[^>]+>|&[^;]*;/gi;
	 				if (!pattern.test(description)) {
	 					contentTab.setActiveTab(1);
	 					Ext.getCmp("description2").setValue(description);
	 				} else {
	 					contentTab.setActiveTab(0);
	 					Ext.getCmp("description1").setValue(description);
	 				}	 				
	 				
	 			},
	 			failure     : function(form,action) {
	 				Ext.Msg.alert("失败",action.result.msg);
	 			},
	 			params      : {
	 				data    : Ext.util.JSON.encode(this.$config.postData)
	 			}
	 	});			
		
	}
	
});


Ext.reg('categorycontent-win',VAS.CategoryContentWindow);

